/**
 * Created by wdj on 16/4/21.
 * ProfileController
 */
'use strict';
var Controller = require('../Controller');
var imagePicker = require('dao6-hybrid').plugin.imagePicker;

class ProfileController extends Controller {

    onCreated(app, page) {

        this.bindEvents({
            'click img.user-avatar': function () {
                var img = this;
                imagePicker.open({
                    editing: true,
                    title: '选择头像'
                },function (sts, info) {
                    if(sts && info.url){
                        app.alert(img.src + '<br>' + info.url, sts);
                        Dom7(img).attr('src', info.url);
                        // img.setAttribute('src', info.url);
                        // img.src = info.url;
                    }
                });
            }
        })
    }
}

export default ProfileController;
